home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacGofer 0.22d / MacGofer Sources / xtra.c < prev   
Encoding:
C/C++ Source or Header  |  1994-01-06  |  501 b   |  37 lines  |  [TEXT/MPS ]

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <errno.h>
  4. extern int errno;
  5.  
  6.  
  7. /*#include <perror.h>
  8. #include <file.h>
  9. */
  10.  
  11.  
  12.  
  13. /* Like malloc but get fatal error if memory is exhausted.  */
  14.  
  15. int
  16. xmalloc (size)
  17.      int size;
  18. {
  19.   int result = malloc (size);
  20.   if (!result)
  21.     fatal ("virtual memory exhausted", 0);
  22.   return result;
  23. }
  24.  
  25.  
  26. int
  27. xrealloc (ptr, size)
  28.      char *ptr;
  29.      int size;
  30. {
  31.   int result = realloc (ptr, size);
  32.   if (!result)
  33.     fatal ("virtual memory exhausted");
  34.   return result;
  35. }
  36.  
  37.